package com.monitoring.infrastructure.persistence;

import com.monitoring.domain.entity.Device;
import com.monitoring.domain.repository.DeviceRepository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface JpaDeviceRepository extends JpaRepository<Device, Long>, DeviceRepository {
    @Override
    <T extends Device> T save(T device);
    
    @Override
    List<Device> findByType(String type);
    
    @Override
    List<Device> findByLocation(String location);
    
    List<Device> findByActiveTrue();
    @Query("SELECT d FROM Device d WHERE d.active = true")
    List<Device> findActiveDevices();
}